package presentacion.personal;

import CapaDatos.Sql;
import clases.general.Ciudad;
import global.Dialogos;
import global.Iconos;
import java.awt.Image;
import java.io.File;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;

public final class dlgPersonal extends javax.swing.JDialog {
    private Iconos ico = new Iconos();

    public JFileChooser ventana = new JFileChooser();
    public Icon icono;
    public String ruta = "";

    /**
     * Creates new form dlgConcep
     *
     * @param parent
     * @param modal
     */
    public dlgPersonal(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(this);
        setResizable(false);
        iconos();
        visiblidad(true);
        limpiar();
    }
    
    private void iconos() {
        btnnuevo.setIcon(ico.getNuevo());
        btnguardar.setIcon(ico.getGuardar());
        btnsalir.setIcon(ico.getSalir());
        btnactualizar.setIcon(ico.getActualizar());
    }

    public void llenardatos() {
        txtcedula.setEditable(false);
        txtcedula.setText(frmConsultaPersonal.objEmpleado.getCedulaRuc());
        txtnombres.setText(frmConsultaPersonal.objEmpleado.getNombre());
        txtapellido.setText(frmConsultaPersonal.objEmpleado.getApellido());
        txtsueldo.setText(frmConsultaPersonal.objEmpleado.getSueldo());
        txtdireccion.setText(frmConsultaPersonal.objEmpleado.getDireccion());
        txtdireccion2.setText(frmConsultaPersonal.objEmpleado.getDireccion2());
        txttelefono.setText(frmConsultaPersonal.objEmpleado.getTelefono());
        txtcelular.setText(frmConsultaPersonal.objEmpleado.getCelular());
        cboprofesion.setSelectedItem(frmConsultaPersonal.objEmpleado.getProfesion());
        cboarea.setSelectedItem(frmConsultaPersonal.objEmpleado.getArea());
        cbocargo.setSelectedItem(frmConsultaPersonal.objEmpleado.cargo.getCargo());
        cboestadocivil.setSelectedItem(frmConsultaPersonal.objEmpleado.getEstadocivil());
        dtaño.setYear(frmConsultaPersonal.objEmpleado.getAnio());
        dtaño.setEnabled(false);
        cbosexo.setSelectedItem(frmConsultaPersonal.objEmpleado.getSexo());
        txtcorreo.setText(frmConsultaPersonal.objEmpleado.getCorreo());
        cbociudad.setSelectedItem(frmConsultaPersonal.objEmpleado.getCiudad());
        dtfechaingeso.setDate(global.Util.StringaDate(frmConsultaPersonal.objEmpleado.getFechaingreso()));
        dtfechanaci.setDate(global.Util.StringaDate(frmConsultaPersonal.objEmpleado.getFechanacimiento()));

        if (frmConsultaPersonal.objEmpleado.ExistenciaFotoEmpleado() == true) {
            icono = new ImageIcon(Sql.getfoto("SELECT FOTO FROM PERSONAL WHERE CEDULARUC='" + frmConsultaPersonal.objEmpleado.getCedulaRuc() + "'"
            ).getScaledInstance(lblfoto.getWidth(), lblfoto.getHeight(), Image.SCALE_DEFAULT));
            lblfoto.setText("");
            lblfoto.setIcon(icono);
        } else {
            lblfoto.setText("FOTO");
        }
    }

    public void visiblidad(boolean visibilidad) {
        if (visibilidad != true) {
            btnactualizar.setVisible(true);
            btnguardar.setVisible(false);
        } else {
            btnactualizar.setVisible(false);
            btnguardar.setVisible(true);
        }
    }

    private boolean Valadicaion() {
        if ("".equals(this.txtcedula.getText())) {
            Dialogos.FaltaCampo("Cedula");
            this.txtcedula.requestFocus();
            return false;
        } else if (global.Validaciones.validarCedula(this.txtcedula.getText()) == false) {
            global.Mensajes.mostrarMensaje("Error", "Cedula incorrecta", 3);
            this.txtcedula.requestFocus();
            return false;

        } else if ("".equals(this.txtnombres.getText())) {
            Dialogos.FaltaCampo("Nombres");
            this.txtnombres.requestFocus();
            return false;
        } else if ("".equals(this.txtapellido.getText())) {
            Dialogos.FaltaCampo("Apellidos");
            this.txtapellido.requestFocus();
            return false;
        } else if ("".equals(this.txtcelular.getText())) {
         Dialogos.FaltaCampo("Celular");
         this.txtcelular.requestFocus();
         return false;
         } else if ("--Seleccione--".equals(this.cbosexo.getSelectedItem())) {
            Dialogos.FaltaCampo("Genero");
            this.cbosexo.requestFocus();
            return false;
        } else if ("--Seleccione--".equals(cbocargo.getSelectedItem())) {
            Dialogos.FaltaCampo("Cargo");
            cbocargo.requestFocus();
            return false;
        } else if ("".equals(this.txtsueldo.getText())) {
            Dialogos.FaltaCampo("Sueldo");
            this.txtsueldo.requestFocus();
            return false;
        } else if ("--Seleccione--".equals(this.cboestadocivil.getSelectedItem())) {
            Dialogos.FaltaCampo("Estado Civil");
            this.cboestadocivil.requestFocus();
            return false;
        } else if ("--Seleccione--".equals(this.cboprofesion.getSelectedItem())) {
            Dialogos.FaltaCampo("Profesion");
            this.cboprofesion.requestFocus();
            return false;
        } else if ("".equals(this.txtdireccion.getText())) {
            Dialogos.FaltaCampo("Calle");
            this.txtdireccion.requestFocus();
            return false;
        } else if ("--Seleccione--".equals(cbociudad.getSelectedItem())) {
            Dialogos.FaltaCampo("Ciudad");
            cbociudad.requestFocus();
            return false;
        } 
        return true;
    }

    private void insertarFoto() {
        if (!ruta.equals("")) {
            Sql.insertarFoto("UPDATE PERSONAL SET FOTO=? WHERE CEDULARUC='" + frmConsultaPersonal.objEmpleado.getCedulaRuc()
                    + "'", ruta);
        }
    }

    private void Set() {
        frmConsultaPersonal.objEmpleado.setCedulaRuc(txtcedula.getText());
        frmConsultaPersonal.objEmpleado.setNombre(txtnombres.getText());
        frmConsultaPersonal.objEmpleado.setApellido(txtapellido.getText());
        frmConsultaPersonal.objEmpleado.setTelefono(txttelefono.getText());
        frmConsultaPersonal.objEmpleado.setCelular(txtcelular.getText());
        frmConsultaPersonal.objEmpleado.setDireccion(txtdireccion.getText());
        frmConsultaPersonal.objEmpleado.setDireccion2(txtdireccion2.getText());
        frmConsultaPersonal.objEmpleado.setCorreo(txtcorreo.getText().toLowerCase());
        frmConsultaPersonal.objEmpleado.setProfesion(cboprofesion.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setArea(cboarea.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setSueldo(txtsueldo.getText());
        frmConsultaPersonal.objEmpleado.setAnio(dtaño.getYear());
        frmConsultaPersonal.objEmpleado.cargo.sacarIdSectorial(cbocargo.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setSexo(cbosexo.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setEstadocivil(cboestadocivil.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setCiudad(cbociudad.getSelectedItem().toString());
        frmConsultaPersonal.objEmpleado.setFechanacimiento(global.Util.DateaString(dtfechanaci.getDate()));
        frmConsultaPersonal.objEmpleado.setFechaingreso(global.Util.DateaString(dtfechaingeso.getDate()));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        dtfechanaci = new com.toedter.calendar.JDateChooser();
        txttelefono = new javax.swing.JTextField();
        txtnombres = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtapellido = new javax.swing.JTextField();
        txtcedula = new javax.swing.JTextField();
        cbosexo = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        cboestadocivil = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        cbociudad = new javax.swing.JComboBox();
        btnciudad = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        dtfechaingeso = new com.toedter.calendar.JDateChooser();
        jLabel4 = new javax.swing.JLabel();
        cbocargo = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        txtsueldo = new javax.swing.JTextField();
        cboprofesion = new javax.swing.JComboBox();
        btncargo = new javax.swing.JButton();
        btnprofesion = new javax.swing.JButton();
        btnexaminar = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        lblfoto = new javax.swing.JLabel();
        dtaño = new com.toedter.calendar.JYearChooser();
        jLabel13 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        txtcelular = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txtcorreo = new javax.swing.JTextField();
        txtdireccion = new javax.swing.JTextField();
        txtdireccion2 = new javax.swing.JTextField();
        cboarea = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        btnprofesion1 = new javax.swing.JButton();
        jToolBar4 = new javax.swing.JToolBar();
        btnnuevo = new javax.swing.JButton();
        btnguardar = new javax.swing.JButton();
        btnactualizar = new javax.swing.JButton();
        btnsalir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setText("APELLIDOS");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setText("TELÉFONO");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setText("CALLE");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setText("FECHA NACIMIENTO");

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("CÉDULA");

        txttelefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txttelefonoKeyTyped(evt);
            }
        });

        txtnombres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtnombresKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtnombresKeyTyped(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setText("NOMBRES");

        txtapellido.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtapellidoKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtapellidoKeyTyped(evt);
            }
        });

        txtcedula.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtcedulaKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtcedulaKeyTyped(evt);
            }
        });

        cbosexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Seleccione--", "MASCULINO", "FEMENINO" }));

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("GÉNERO");

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel9.setText("ESTADO CIVIL");

        cboestadocivil.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Seleccione--", "SOLTERO", "CASADO", "VIUDO", "DIVORCIADO", "UNION LIBRE" }));

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("CIUDAD");

        btnciudad.setText("+");
        btnciudad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnciudadActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel14.setText("TÍTULOS/ESTUDIOS");

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel12.setText("FECHA INGRESO");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("CARGO");

        cbocargo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Seleccione--", "DOCENTE" }));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("SUELDO");

        txtsueldo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtsueldoKeyTyped(evt);
            }
        });

        cboprofesion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "INGENIERO", "ARQUITECTO" }));

        btncargo.setText("+");
        btncargo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncargoActionPerformed(evt);
            }
        });

        btnprofesion.setText("+");
        btnprofesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnprofesionActionPerformed(evt);
            }
        });

        btnexaminar.setText("Examinar");
        btnexaminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnexaminarActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(0));

        lblfoto.setBackground(new java.awt.Color(255, 255, 255));
        lblfoto.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblfoto.setText("FOTO");
        lblfoto.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblfoto, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblfoto, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)
                .addContainerGap())
        );

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel13.setText("AÑO");

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel15.setText("$");

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel16.setText("INTERSECCIÓN");

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel17.setText("CELULAR");

        txtcelular.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtcelularKeyTyped(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel18.setText("CORREO");

        txtcorreo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtcorreoKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtcorreoKeyTyped(evt);
            }
        });

        txtdireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtdireccionKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtdireccionKeyTyped(evt);
            }
        });

        txtdireccion2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtdireccion2KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtdireccion2KeyTyped(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel19.setText("ÁREA");

        btnprofesion1.setText("+");
        btnprofesion1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnprofesion1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel1)
                            .addComponent(jLabel6)
                            .addComponent(jLabel5)
                            .addComponent(jLabel17))
                        .addGap(60, 60, 60)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtapellido, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtcedula, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtnombres, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txttelefono, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtcelular, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(19, 19, 19)
                                .addComponent(btnexaminar)))
                        .addGap(157, 157, 157))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addGap(62, 62, 62)
                                    .addComponent(jLabel15)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txtsueldo, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(26, 26, 26)
                                    .addComponent(jLabel13)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(dtaño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(124, 124, 124))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel10)
                                                .addComponent(jLabel12)
                                                .addComponent(jLabel4))
                                            .addGap(31, 31, 31)
                                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addComponent(dtfechaingeso, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(cbosexo, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(jPanel3Layout.createSequentialGroup()
                                                    .addComponent(cbocargo, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(btncargo))
                                                .addGroup(jPanel3Layout.createSequentialGroup()
                                                    .addComponent(cboarea, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(btnprofesion1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                            .addComponent(jLabel11)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(dtfechanaci, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGap(117, 117, 117)))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel19)
                                .addGap(108, 108, 108)))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel18)
                            .addComponent(jLabel7)
                            .addComponent(jLabel16)
                            .addComponent(jLabel14)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(cbociudad, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnciudad))
                            .addComponent(txtdireccion2, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtdireccion, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(cboestadocivil, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(cboprofesion, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnprofesion))
                            .addComponent(txtcorreo, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(41, 41, 41))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnexaminar)
                        .addGap(25, 25, 25)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(cboestadocivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnprofesion, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel14)
                                .addComponent(cboprofesion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel11)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel1)
                                .addComponent(txtcedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(25, 25, 25)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3)
                                .addComponent(txtnombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(25, 25, 25)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(txtapellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(25, 25, 25)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel6)
                                .addComponent(txttelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtcelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel17))
                            .addGap(25, 25, 25)
                            .addComponent(dtfechanaci, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(cbosexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(txtcorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(dtfechaingeso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtdireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel12))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbocargo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(btncargo)
                    .addComponent(jLabel16)
                    .addComponent(txtdireccion2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(cbociudad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnciudad))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel19)
                        .addComponent(cboarea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnprofesion1)))
                .addGap(25, 25, 25)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(dtaño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(txtsueldo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel13)
                        .addComponent(jLabel15)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jToolBar4.setBorder(null);
        jToolBar4.setFloatable(false);
        jToolBar4.setBorderPainted(false);

        btnnuevo.setText("Nuevo");
        btnnuevo.setFocusable(false);
        btnnuevo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnnuevo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnnuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnnuevoActionPerformed(evt);
            }
        });
        jToolBar4.add(btnnuevo);

        btnguardar.setText("Guardar");
        btnguardar.setFocusable(false);
        btnguardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnguardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnguardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnguardarActionPerformed(evt);
            }
        });
        jToolBar4.add(btnguardar);

        btnactualizar.setText("Actualizar");
        btnactualizar.setFocusable(false);
        btnactualizar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnactualizar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnactualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnactualizarActionPerformed(evt);
            }
        });
        jToolBar4.add(btnactualizar);

        btnsalir.setText("Salir");
        btnsalir.setFocusable(false);
        btnsalir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnsalir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnsalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirActionPerformed(evt);
            }
        });
        jToolBar4.add(btnsalir);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jToolBar4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void limpiar() {
        dtaño.setEnabled(true);
        txtcedula.setEditable(true);
        txtcedula.setText("");
        txtsueldo.setText("");
        txtapellido.setText("");
        txtdireccion.setText("");
        txtnombres.setText("");
        txttelefono.setText("");
        txtdireccion2.setText("");
        txtcelular.setText("");
        txtcorreo.setText("");
        frmConsultaPersonal.objEmpleado.comboProfesion(cboprofesion);
        frmConsultaPersonal.objEmpleado.comboArea(cboarea);
        frmConsultaPersonal.objEmpleado.comboCiudad(cbociudad);
        frmConsultaPersonal.objEmpleado.cargo.listarCargo(cbocargo);
        cbociudad.setSelectedIndex(0);
        cboestadocivil.setSelectedIndex(0);
        cbosexo.setSelectedIndex(0);
        lblfoto.setText("FOTO");
        lblfoto.setIcon(null);
        txtcedula.requestFocus();
        dtfechaingeso.setDate(global.Util.StringaDate(global.Util.getFechaActual()));
        dtfechanaci.setDate(global.Util.StringaDate(global.Util.getFechaActual()));
    }

    private void btnnuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnnuevoActionPerformed
        limpiar();
        visiblidad(true);

    }//GEN-LAST:event_btnnuevoActionPerformed

    private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed
        if (this.Valadicaion() == true) {
            this.Set();

            if (frmConsultaPersonal.objEmpleado.guardarEmpleado() == true
                    && frmConsultaPersonal.objEmpleado.GuardarSueldo() == true
                    && frmConsultaPersonal.objEmpleado.GuardarIngreso()) {
                frmConsultaPersonal.generartabla();
                limpiar();
                if (!"".equals(ruta)) {
                    this.insertarFoto();
                }
            }
        }
    }//GEN-LAST:event_btnguardarActionPerformed

    private void btnsalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirActionPerformed
        dispose();
        limpiar();

    }//GEN-LAST:event_btnsalirActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        limpiar();
    }//GEN-LAST:event_formWindowClosed

    private void btnactualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnactualizarActionPerformed
        if (this.Valadicaion() == true) {
            //frmConsultaPersonal.objEmpleado.sacarIdSueldo(txtsueldo.getText(), Integer.toString(dtaño.getYear()));
            this.Set();

            if (frmConsultaPersonal.objEmpleado.actualizarEmpleado() == true
                    && frmConsultaPersonal.objEmpleado.actualizarSueldo() == true
                    && frmConsultaPersonal.objEmpleado.actualizarIngreso() == true) {
                frmConsultaPersonal.generartabla();
                dispose();
                limpiar();
                if (!"".equals(ruta)) {
                    this.insertarFoto();
                }
            }
        }

    }//GEN-LAST:event_btnactualizarActionPerformed

    private void txtcedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcedulaKeyTyped
        global.Validaciones.soloNumeros(evt, txtcedula, 10);
    }//GEN-LAST:event_txtcedulaKeyTyped

    private void txtapellidoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtapellidoKeyTyped
        global.Validaciones.soloLetras(evt, txtapellido);
    }//GEN-LAST:event_txtapellidoKeyTyped

    private void txtapellidoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtapellidoKeyReleased
        global.Validaciones.convertirMayuscula(txtapellido);
    }//GEN-LAST:event_txtapellidoKeyReleased

    private void txtnombresKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtnombresKeyTyped
        global.Validaciones.soloLetras(evt, txtnombres);
    }//GEN-LAST:event_txtnombresKeyTyped

    private void txtnombresKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtnombresKeyReleased
        global.Validaciones.convertirMayuscula(txtnombres);
    }//GEN-LAST:event_txtnombresKeyReleased

    private void txttelefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txttelefonoKeyTyped
        global.Validaciones.soloNumeros(evt, txttelefono, 10);
    }//GEN-LAST:event_txttelefonoKeyTyped

    private void txtsueldoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtsueldoKeyTyped
        // global.Validaciones.soloNumeros(evt, txtsueldo, 15);

    }//GEN-LAST:event_txtsueldoKeyTyped

    private void txtcedulaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcedulaKeyReleased

    }//GEN-LAST:event_txtcedulaKeyReleased

    private void btnciudadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnciudadActionPerformed
        String ciudad = "";
        ciudad = global.Dialogos.mostrarDialogoconTexto("AGREGAR CIUDAD", null);
        if (ciudad != null && !"".equals(ciudad)) {
            Ciudad objCiudad = new Ciudad();
            objCiudad.setNombreCiudad(ciudad.toUpperCase());
            if (objCiudad.guardarCiudad() == true) {
                cbociudad.addItem(ciudad.toUpperCase());
            }

        }
    }//GEN-LAST:event_btnciudadActionPerformed

    private void btncargoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncargoActionPerformed
        dlgCargo cargo = new dlgCargo(null, true);
        cargo.setVisible(true);
    }//GEN-LAST:event_btncargoActionPerformed

    private void btnprofesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnprofesionActionPerformed
        String profesion;
        profesion = "";
        profesion = global.Dialogos.mostrarDialogoconTexto("AGREGAR PROFESIÓN", null);
        if (profesion != null && !"".equals(profesion)) {
            cboprofesion.addItem(profesion.toUpperCase());
        }
    }//GEN-LAST:event_btnprofesionActionPerformed

    private void btnexaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnexaminarActionPerformed
        int resultado;

        FileNameExtensionFilter filtro = new FileNameExtensionFilter("JPG", "jpg");
        ventana.setFileFilter(filtro);
        resultado = ventana.showOpenDialog(lblfoto);

        if (JFileChooser.APPROVE_OPTION == resultado) {
            File foto = ventana.getSelectedFile();
            try {
                ImageIcon icon = new ImageIcon(foto.toString());
                icono = new ImageIcon(icon.getImage().getScaledInstance(lblfoto.getWidth(), lblfoto.getHeight(), Image.SCALE_SMOOTH));
                lblfoto.setText(null);
                lblfoto.setIcon(icono);
                ruta = ventana.getSelectedFile().getAbsolutePath();
            } catch (Exception ex) {
                global.Mensajes.mostrarMensaje("Error", "Error abriendo la imagen " + ex, 3);

            }
        }
    }//GEN-LAST:event_btnexaminarActionPerformed

    private void txtcelularKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcelularKeyTyped
        global.Validaciones.soloNumeros(evt, txtcelular, 10);
    }//GEN-LAST:event_txtcelularKeyTyped

    private void txtcorreoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcorreoKeyTyped
        //global.Validaciones.soloLetras(evt, txtcorreo);
    }//GEN-LAST:event_txtcorreoKeyTyped

    private void txtcorreoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcorreoKeyReleased
       // global.Validaciones.convertirMayuscula(txtcorreo);
    }//GEN-LAST:event_txtcorreoKeyReleased

    private void txtdireccionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdireccionKeyTyped
       // global.Validaciones.soloLetras(evt, txtdireccion);
    }//GEN-LAST:event_txtdireccionKeyTyped

    private void txtdireccionKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdireccionKeyReleased
         global.Validaciones.convertirMayuscula(txtdireccion);
    }//GEN-LAST:event_txtdireccionKeyReleased

    private void txtdireccion2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdireccion2KeyReleased
        global.Validaciones.convertirMayuscula(txtdireccion2);
    }//GEN-LAST:event_txtdireccion2KeyReleased

    private void txtdireccion2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtdireccion2KeyTyped
        //global.Validaciones.soloLetras(evt, txtdireccion2);
    }//GEN-LAST:event_txtdireccion2KeyTyped

    private void btnprofesion1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnprofesion1ActionPerformed
       String area;
        area = "";
        area = global.Dialogos.mostrarDialogoconTexto("AGREGAR ÁREA", null);
        if (area != null && !"".equals(area)) {
            cboarea.addItem(area.toUpperCase());
        }
    }//GEN-LAST:event_btnprofesion1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(dlgPersonal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(dlgPersonal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(dlgPersonal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(dlgPersonal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                dlgPersonal dialog = new dlgPersonal(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);

                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnactualizar;
    private javax.swing.JButton btncargo;
    private javax.swing.JButton btnciudad;
    private javax.swing.JButton btnexaminar;
    private javax.swing.JButton btnguardar;
    private javax.swing.JButton btnnuevo;
    private javax.swing.JButton btnprofesion;
    private javax.swing.JButton btnprofesion1;
    private javax.swing.JButton btnsalir;
    private javax.swing.JComboBox cboarea;
    public static javax.swing.JComboBox cbocargo;
    private javax.swing.JComboBox cbociudad;
    private javax.swing.JComboBox cboestadocivil;
    private javax.swing.JComboBox cboprofesion;
    private javax.swing.JComboBox cbosexo;
    private com.toedter.calendar.JYearChooser dtaño;
    private com.toedter.calendar.JDateChooser dtfechaingeso;
    private com.toedter.calendar.JDateChooser dtfechanaci;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JToolBar jToolBar4;
    public javax.swing.JLabel lblfoto;
    private javax.swing.JTextField txtapellido;
    private javax.swing.JTextField txtcedula;
    private javax.swing.JTextField txtcelular;
    private javax.swing.JTextField txtcorreo;
    private javax.swing.JTextField txtdireccion;
    private javax.swing.JTextField txtdireccion2;
    private javax.swing.JTextField txtnombres;
    private javax.swing.JTextField txtsueldo;
    private javax.swing.JTextField txttelefono;
    // End of variables declaration//GEN-END:variables
}
